home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000056_fdc@columbia.edu_Sat Apr 27 11:47:43 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  66 lines

  1. Article: 13347 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!news.columbia.edu!news-not-for-mail
  3. From: fdc@columbia.edu (Frank da Cruz)
  4. Newsgroups: comp.unix.programmer,comp.protocols.kermit.misc
  5. Subject: Re: serial port programming
  6. Date: 27 Apr 2002 11:46:55 -0400
  7. Organization: Columbia University
  8. Lines: 49
  9. Message-ID: <aaeh5f$4fc$1@watsol.cc.columbia.edu>
  10. References: <4789aa76.0204270447.6f0a8436@posting.google.com>
  11. NNTP-Posting-Host: watsol.cc.columbia.edu
  12. X-Trace: newsmaster.cc.columbia.edu 1019922416 566 128.59.39.139 (27 Apr 2002 15:46:56 GMT)
  13. X-Complaints-To: postmaster@columbia.edu
  14. NNTP-Posting-Date: 27 Apr 2002 15:46:56 GMT
  15. Xref: newsmaster.cc.columbia.edu comp.unix.programmer:145396 comp.protocols.kermit.misc:13347
  16.  
  17. In article <4789aa76.0204270447.6f0a8436@posting.google.com>,
  18. Tomas <t.camin@libero.it> wrote:
  19. : I'm trying to send some binary data through the serial port to a
  20. : microcontroller asyncronously.
  21. : I found a lot of informations on how to send characters but not binary
  22. : data.
  23. : Is it possible to do this?
  24. Yes, you can use C-Kermit:
  25.  
  26.   http://www.columbia.edu/kermit/ckermit.html
  27.  
  28. If the microcontroller supports Kermit protocol, you're done.  If not...
  29. C-Kermit includes a TRANSMIT command to send a file "bare" out the selected
  30. communication device or network connection, even a binary file:
  31.  
  32.   set modem type none
  33.   set port /dev/ttyS0
  34.   set speed 57600             ; or whatever
  35.   set flow rts/cts            ; if possible -- xon/xoff can't be used here
  36.   transmit /binary /noecho /nowait <filename> 
  37.  
  38. Now the question is: how does the microcontroller know when the transmission
  39. is finished, when any byte sequence at all might be found in the file data?
  40. Only you know the answer to that question.  In one common scenario, the
  41. device accepts data until a certain interval of "silence" has passed.  In
  42. another, the sender "hangs up" the connection by dropping DTR.  In Kermit
  43. this would be done with:
  44.  
  45.   set modem hangup dtr
  46.   hangup
  47.  
  48. If this sequence doesn't work, the speed, flow, and various other parameters
  49. can be adjusted until it does.
  50.  
  51. The technique described here is used with increasing frequency to load image,
  52. audio, or video data into players or recorders.  Obviously it requires a
  53. clean, transparent, error-free connnection; otherwise you need an error-
  54. detecting and correcting protocol (such as Kermit).
  55.  
  56. By the way, you don't want to program this kind of thing yourself in C.
  57. Serial-port programming is quite tricky and totally nonportable.  Each
  58. release of each Unix variation (Linux, *BSD, Solaris, HP-UX, AIX, etc) is
  59. different.  That's why it's a good idea to use software whose job it is
  60. to keep up with all this so you don't have to.
  61.  
  62. - Frank
  63.